﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace WaterKit.Base
{
    /// <summary>
    /// 应用程序基本函数
    /// </summary>
    public class AppOpr
    {
        /// <summary>
        /// 获取配置文件中的节点信息
        /// </summary>
        /// <param name="strKey"></param>
        /// <returns></returns>
        public static string GetConfigStrings(string strKey)
        {
            try
            {
                return ConfigurationManager.AppSettings[strKey];
            }
            catch (Exception ex)
            {
                Log4C.WriteErrLog("获取程序配置信息出错", ex);
                return "";
            }

            /* 遍历方式读取
             * foreach (string key in ConfigurationManager.AppSettings)
            {
                if (key == strKey)
                {
                    return ConfigurationManager.AppSettings[strKey];
                }
            }
            return null; */
        }
    }
}
